﻿/// <reference path="../Turbo/turbo.js" />

var $ClientEvent = TA.Turbo.Common.ClientEvent = function ClientEvent(name)
{
	this._name = name;
}
$ClientEvent.prototype._name = "";

$ClientEvent.prototype.Init = function Init(obj)
{
	var fnName = obj.get_Control().getAttribute(this._name + "-Client");
	if (fnName == "" || fnName == null) return;
	obj.get_Control().removeAttribute(this._name + "-Client");

	obj.AddEvent(this._name, fnName);
}

var $ServerEvent = TA.Turbo.Common.ServerEvent = function ServerEvent(name)
{
	this.ClientEvent(name);
}
$ServerEvent.Inherit($ClientEvent);
var _____a;
if (_____a)
{
	$ServerEvent.prototype = new $ClientEvent();
	$ServerEvent.prototype.ClientEvent = new $ClientEvent();
}
$ServerEvent.prototype.Init = function Init(obj)
{
	this.ClientEvent.Init.call(this, obj);

	var eventPostScenarioId = obj.get_Control().getAttribute(this._name + "-Server");
	if (eventPostScenarioId == null) return;
	obj.get_Control().removeAttribute(this._name + "-Server");

	obj.AddServerEvent(this._name, TA.Turbo.Common.GetControlServerName(obj.get_Control()), eventPostScenarioId);
}
